'use strict';
const {
	Router
} = require('dx-router-admin')
const config = require('./config.js');

exports.main = async (event, context) => {

	//event为客户端上传的参数
	//console.log('event : ', event)
	// console.log(new Router().run())
    for(let key in event.data){
    	const value = event.data[key];
    	if(key.endsWith('date')&&Array.isArray(value)&&value.length==2){
    		event.data[key] = ['between',[new Date(value[0]).getTime(),new Date(value[1]).getTime()+24*60*60*1000]];
    	}
    }
	//返回数据给客户端
	return new Router(event, context, config).run();
};
